/* This code is for the APPENDIX to empirical analysis of "Democratization and FDI Liberalization, 1970-2000" */cd "/Users/ssp5d/Desktop/RESEARCH/data_sonal/"use "/Users/ssp5d/Desktop/RESEARCH/data_sonal/full.interp.approve.dta", cleartsset cty1 year1sort cty1 year1replace polity4 = polity4 + 10 /* rescale polity4 measure to vary 0-20 */gen polity_binary = 0 replace polity_binary = 1 if polity4 > 15gen ln_gdp_pc = ln(gdp_pc) gen aid = aid_gdp/100gen currency_demo = polity_binary*currencygen bank_demo = polity_binary*bankgen resched_demo = polity_binary*reschedulegen left_demo = l.polity4*l.left_partygen plp_demo = l.polity4*l.plpgen demo_currency = democracy*currency gen demo_bank = democracy*bank  gen demo_resched = democracy*reschedule gen demo_imf = signed_imf*democracylabel var major_jv "Minority Local Ownership"label var polity4 "Polity Score (t-1)"label var currency  "Currency Crisis (t-1)"label var bank "Banking Crisis (t-1)"label var reschedule "Sovereign Debt Rescheduled (t-1)"label var signed_imf "IMF Conditionality (t-1)" label var gdp_pc  "Ln(Per Capita GDP) (t-1)"label var gov_res "Government Ownership (t-1)" label var entry_res "Entry Restrictions"label var approve_agg "Investment Screening"label var democracy "Democracy(Binary)(t-1)"label var majorjv_lang "Average Restrictions - Language Group(t-1)"label var major_jv_colony "Average Restrictions - Colonial Origin(t-1)"label var aid "Aid/GNI(t-1)" label var currency_demo "Currency Crisis(t-1)*Polity Score(t-1)"label var bank_demo "Banking Crisis(t-1)*Polity Score(t-1)"label var resched_demo "Sovereign Debt Rescheduled(t-1)*Polity Score(t-1)"label var demo_currency "Currency Crisis(t-1)*Democracy(Binary)(t-1)"label var demo_bank  "Banking Crisis(t-1)*Democracy(Binary)(t-1)"label var demo_resched "Sovereign Debt Rescheduled(t-1)*Democracy(Binary)(t-1)"/* Economic Crises (Approval Measure) */xi: xtpcse approve_agg l.democracy l.currency l.demo_currency l.ln_gdp_pc i.year1 i.cty , corr(psar1) outreg2 approve_agg  democracy currency demo_currency ln_gdp_pc using appendixtab3.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel replace  xi: xtpcse approve_agg  l.democracy l.bank l.demo_bank l.ln_gdp_pc i.cty i.year1, corr(psar1) pairwiseoutreg2 approve_agg  l.democracy l.bank l.demo_bank l.ln_gdp_pc using appendixtab3.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel appendxi: xtpcse approve_agg l.democracy l.reschedule l.demo_resched l.ln_gdp_pc i.year1 i.cty, corr(psar1) pairwiseoutreg2 approve_agg l.democracy  l.reschedule l.demo_resched l.ln_gdp_pc using appendixtab3.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel appendxi: xtpcse approve_agg l.democracy l.currency l.bank l.reschedule l.demo_currency  l.demo_bank l.demo_resched l.ln_gdp_pc i.cty i.year1, corr(psar1) outreg2 approve_agg l.democracy l.demo_currency l.currency l.bank l.demo_bank l.reschedule l.demo_resched l.ln_gdp_pc using appendixtab3.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel append/* External Influences on Foreign Ownership Liberalization (Approval Measure) */xi: xtpcse approve_agg l.democracy l.signed_imf l.ln_gdp_pc i.cty i.year1, corr(psar1) pairwiseoutreg2 approve_agg l.democracy l.signed_imf l.ln_gdp_pc using appendixtab4.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel replacexi: xtpcse approve_agg l.democracy l.signed_imf l.demo_imf l.ln_gdp_pc i.cty i.year1,corr(psar1) pairwiseoutreg2 approve_agg l.democracy l.signed_imf l.demo_imf l.ln_gdp_pc using appendixtab4.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel appendxi: xtpcse approve_agg l.democracy l.approve_lang l.approve_agg_colony l.ln_gdp_pc i.cty1, corr(psar1) pairwiseoutreg2 approve_agg l.democracy l.approve_lang l.approve_agg_colony l.ln_gdp_pc using appendixtab4.out, drop(i.cty*) lab 10pct nor2 word excel appendxi: xtpcse approve_agg l.democracy spain_colony france_colony belgium_colony dutch_colony l.ln_gdp_pc i.cty1 i.year1, corr(psar1) outreg2 approve_agg l.democracy spain_colony france_colony belgium_colony dutch_colony l.ln_gdp_pc using appendixtab4.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel appendxi: xtpcse approve_agg l.democracy l.currency l.bank l.reschedule l.signed_imf l.approve_lang l.approve_agg_colony l.ln_gdp_pc i.cty, corr(psar1) pairwiseoutreg2 approve_agg l.democracy l.currency l.bank l.reschedule l.signed_imf l.approve_lang l.approve_agg_colony l.ln_gdp_pc using appendixtab4.out, drop(i.cty*) lab 10pct nor2 word excel append/* Alternate Measure of Democratization (Approval Measure) */xi: xtpcse approve_agg  l.polity_binary l.ln_gdp_pc i.cty1 i.year1, corr(psar1) pairwiseoutreg2 approve_agg l.polity_binary l.ln_gdp_pc using appendixtab5.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel replace xi: xtpcse approve_agg  l.polity_binary l.currency l.bank l.reschedule l.currency_demo l.bank_demo l.resched_demo  l.ln_gdp_pc i.cty i.year1, corr(psar1) outreg2 approve_agg  l.polity_binary l.currency l.bank l.reschedule l.currency_demo l.bank_demo l.resched_demo l.ln_gdp_pc using appendixtab5.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel appendxi: xtpcse approve_agg  l.polity_binary l.signed_imf l.ln_gdp_pc i.cty i.year1, corr(psar1) pairwiseoutreg2 approve_agg  l.polity_binary l.signed_imf l.ln_gdp_pc using appendixtab5.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel append gen polity_imf = signed_imf*polity_binaryxi: xtpcse approve_agg  l.polity_binary l.signed_imf l.polity_imf l.ln_gdp_pc i.cty i.year1, corr(psar1) pairwiseoutreg2 approve_agg  l.polity_binary l.signed_imf  l.polity_imf l.ln_gdp_pc using appendixtab5.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel append xi: xtpcse approve_agg  l.polity_binary l.approve_lang l.approve_agg_colony l.ln_gdp_pc i.cty, corr(psar1) pairwiseoutreg2 approve_agg  l.polity_binary l.approve_lang l.approve_agg_colony l.ln_gdp_pc using appendixtab5.out, drop(i.cty*) lab 10pct nor2 word excel append xi: xtpcse approve_agg  l.polity_binary spain_colony france_colony belgium_colony dutch_colony l.ln_gdp_pc i.cty1 i.year1, corr(psar1) outreg2 approve_agg  l.polity_binary spain_colony france_colony belgium_colony dutch_colony l.ln_gdp_pc using appendixtab5.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel appendxi: xtpcse approve_agg l.polity_binary l.currency l.bank l.reschedule l.signed_imf l.approve_lang l.approve_agg_colony l.ln_gdp_pc i.cty, corr(psar1) pairwiseoutreg2 approve_agg l.polity_binary l.currency l.bank l.reschedule l.signed_imf l.approve_lang l.approve_agg_colony l.ln_gdp_pc using appendixtab5.out, drop(i.cty*) lab 10pct nor2 word excel append/* IV Regression: Time Since Independence (Approval Measure) */xi: xtivreg approve_agg l.ln_gdp_pc (l.democracy=l.time_since), fe outreg2 approve_agg l.democracy l.ln_gdp_pc using appendixtab6.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel replace xi: xtivreg approve_agg  l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc (l.democracy=l.time_since), fe outreg2 approve_agg l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using appendixtab6.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel append 

/* 20 Point Polity Variable */ xi: xtpcse entry_res l.polity4 l.ln_gdp_pc i.cty1 i.year1, corr(psar1) pairwiseoutreg2 entry_res  l.polity4  l.ln_gdp_pc using aprtab7.out, drop(i.cty1*,i.year1*) lab 10pct nor2 word excel replace xi: xtpcse entry_res l.polity4 l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc i.cty, corr(psar1) pairwiseoutreg2 entry_res  l.polity4  l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using aprtab7.out, drop(i.cty*,i.year1*) lab 10pct nor2 word excel append /* age of democracy */xi: xtpcse entry_res l.age_of_demo l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc i.cty1, corr(psar1) pairwiseoutreg2 l.age_of_demo l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using aprtab11.out, drop(i.cty1*) lab 10pct nor2 word excel replace
/*  Binary Measure of Foreign Ownership Restrictions */gen approve_binary = 0replace approve_binary = 1 if approve_agg > .5xi:xtlogit approve_binary l.approve_binary l.democracy l.currency l.bank l.reschedule l.signed_imf l.approve_lang l.approve_agg_colony l.ln_gdp_pc, feoutreg2 approve_binary l.approve_binary l.democracy l.currency l.bank l.reschedule l.signed_imf l.approve_lang l.approve_agg_colony l.ln_gdp_pc using appendixtab7.out, lab 10pct nor2 word excel replace   use "/Users/ssp5d/Desktop/RESEARCH/data_sonal/full.interp.entry.dta", cleartsset cty1 year1sort cty1 year1gen ln_gdp_pc = ln(gdp_pc)gen entry_binary = 0replace entry_binary = 1 if entry_res > .5xi:xtlogit entry_binary l.entry_binary l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc, feoutreg2 entry_binary l.entry_binary l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using appendixtab7.out, lab 10pct nor2 word excel append   


use "/Users/ssp5d/Dropbox/data_sonal/notoecd.dta", cleartsset cty1 year1sort cty1 year1gen ln_gdp_pc = ln(gdp_pc)xi: xtpcse entry_res l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc i.cty, corr(psar1) pairwiseoutreg2 entry_res l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using aprtab8.out, drop(i.cty*) lab 10pct nor2 word excel replace

/* GMM */
use "/Users/ssp5d/Desktop/RESEARCH/data_sonal/full.interp.entry.dta", cleartsset cty1 year1sort cty1 year1

xtabond entry_res l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc, two maxldep(2) maxlags(1) vce(robust) outreg l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using aprtab12, lab 10pct nor2 word excel appendxtabond entry_res l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc, two maxldep(2) maxlags(1) vce(robust) inst(time_since)outreg2 l.entry_res l.democracy l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using aprtab12, lab 10pct nor2 word excel replace 

/* Cumulative Measure of Democracy */xi: xtpcse entry_res l.age_of_demo l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc i.cty1, corr(psar1) pairwiseoutreg2 l.age_of_demo l.currency l.bank l.reschedule l.signed_imf l.entryres_lang l.entry_res_colony l.ln_gdp_pc using aprtab11.out, drop(i.cty1*) lab 10pct nor2 word excel replace
